package Chapter6.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;

@Embeddable
public class StudentPk2 implements Serializable {
	private static final long serialVersionUID = 1L;
	private String stCd;
	private String name;

	public StudentPk2() {
	}

	public StudentPk2(String stCd, String name) {
		this.stCd = stCd;
		this.name = name;
	}

	public String getStCd() {
		return stCd;
	}

	public void setStCd(String stCd) {
		this.stCd = stCd;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (!(obj instanceof StudentPk2)) {
			return false;
		}
		StudentPk2 pk = (StudentPk2) obj;
		return (this.name.equals(pk.getName()) && this.stCd
				.equals(pk.getStCd()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.stCd.hashCode();
		hash = hash * prime + this.name.hashCode();
		return super.hashCode();
	}
}
